Moster commit after sourceforge returns from the dead.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Fri, 12 May 2006 20:50:34 +0000 (20:50 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Fri, 12 May 2006 20:50:34 +0000 (20:50 +0000)
 Make filters, shapefile, csv support configurable away at runtime.
 Fix several problems with new XML_UNICODE code.
 Allow expat library configuration at build time
 Allow more custom waypoint icons in Garmin, bring in more category support.
 Many fixes to track stat recalculator.

31 files changed:
gpsbabel/arcdist.c
gpsbabel/cet_util.c
gpsbabel/cet_util.h
gpsbabel/coastexp.c
gpsbabel/compegps.c
gpsbabel/config.h.in
gpsbabel/configure
gpsbabel/configure.in
gpsbabel/csv_util.c
gpsbabel/discard.c
gpsbabel/duplicate.c
gpsbabel/filter_vecs.c
gpsbabel/garmin_tables.c
gpsbabel/garmin_txt.c
gpsbabel/gpx.c
gpsbabel/internal_styles.c
gpsbabel/interpolate.c
gpsbabel/jeeps/gps.h
gpsbabel/jeeps/gpsapp.c
gpsbabel/mingw/Makefile
gpsbabel/mkstyle.sh
gpsbabel/nukedata.c
gpsbabel/polygon.c
gpsbabel/position.c
gpsbabel/reverse_route.c
gpsbabel/sort.c
gpsbabel/stackfilter.c
gpsbabel/trackfilter.c
gpsbabel/vecs.c
gpsbabel/xcsv.c
gpsbabel/xmlgeneric.c

index cbb8ced956e1a8f446120fd5605f4db8cb0b5fac..824960de524f82a46e4ab80dca1e40a0fe3262b0 100644 (file)
@@ -22,6 +22,7 @@
 #include "filterdefs.h"
 #include "grtcirc.h"
 
+#if FILTERS_ENABLED
 #define MYNAME "Arc filter"
 
 static double pos_dist;
@@ -168,3 +169,4 @@ filter_vecs_t arcdist_vecs = {
        NULL,
        arcdist_args
 };
+#endif FILTERS_ENABLED
index 800051cac1529c7248954ac9c7cb14a1d4b500d4..d71f30248e634b91b313f07b1c76894a849af791 100644 (file)
@@ -1160,20 +1160,85 @@ int cet_fprintf(FILE *stream, const cet_cs_vec_t *src_vec, const char *fmt, ...)
        return res;
 }
 
+/*
+ * 'str'  points to an array of XML_Chars which may be UNICODE16
+ * words in native endianness.
+ */
 
-const char *xml_convert_to_char_string(const XML_Char *str)
+const char *xml_convert_to_char_string_n(const XML_Char *src, int *n)
 {
 #ifdef XML_UNICODE  
-       return cet_str_uni_to_utf8(str, wcslen(str));
+       char *utf8;
+       char *utf8b;
+       int i, j;
+
+       /* 
+        * '*n' is the number of source bytes.
+        * Walk over that, converting each character and 
+        * discarding it, but tallying 'i' as the number of
+        * bytes in the destination string.
+        */
+       i = 0;
+       for (j = 0; j < *n; j++) {
+               i += cet_ucs4_to_utf8(NULL, 6, src[j]);
+       }
+
+       /* Update output byte count in caller. */
+       *n = i;
+       
+       /* Appropriately size (not zero terminated) buffer */
+       utf8 = utf8b = xmalloc(i);
+
+       for (j = 0; utf8 < utf8b + i; j++) {
+               utf8 += cet_ucs4_to_utf8(utf8, 6, src[j]);
+       }
+
+       return utf8b;
+#else 
+       return src;
+#endif 
+}
+
+/*
+ * 'str'  points to NULL terminated string of XML_Chars which 
+ * may be UNICODE16 words in native endianness.
+ */
+
+const char *xml_convert_to_char_string(const XML_Char *src)
+{
+#ifdef XML_UNICODE  
+       char *utf8;
+       char *utf8b;
+       int i, j;
+       const XML_Char *in = src;
+
+       /* Walk source array until we find source terminator */
+       i = 0;
+       for (j = 0; src[j]; j++) {
+               i += cet_ucs4_to_utf8(NULL, 6, src[j]);
+       }
+
+       /* We return a NUL terminated string. */
+       utf8 = utf8b = xmalloc(i + 1);
+       in = src;
+
+       for (j = 0; utf8 < utf8b + i; j++) {
+               utf8 += cet_ucs4_to_utf8(utf8, 6, src[j]);
+       }
+       *utf8 = '\0';
+
+       return utf8b;
+       
 #else
-       return str;
+       return src;
 #endif  
 }
 
+
 void xml_free_converted_string(const char *str)
 {
 #ifdef XML_UNICODE  
-       xfree(str);
+       xfree((void *) str);
 #endif  
 }
 
@@ -1210,7 +1275,7 @@ void xml_free_converted_attrs(const char **attr)
 {
 #ifdef XML_UNICODE  
        while (attr != NULL && *attr != NULL) {
-               xfree(*attr);
+               xfree((void *)*attr);
                ++attr;
        }
 #endif
index a5ac1624735b90e277d741f53e0b6fc617901a5a..96febcd884d1ec62307829d450622caf0469da0c 100644 (file)
@@ -121,6 +121,7 @@ void cet_disp_character_set_names(FILE *fout);
  * it.
  */
 
+const char *xml_convert_to_char_string_n(const XML_Char *str, int *nbytes);
 const char *xml_convert_to_char_string(const XML_Char *str);
 void xml_free_converted_string(const char *str);
 
index 834663981e95268166b98e7abb88656aed6acc8e..7c412e2bac5ac94a290f19d5ae3ba56e712300e4 100755 (executable)
@@ -192,7 +192,8 @@ ce_end(void *data, const XML_Char *xml_el)
 static void
 ce_cdata(void *dta, const XML_Char *xml_s, int len)
 {
-       const char *s = xml_convert_to_char_string(xml_s);
+       const char *origs = xml_convert_to_char_string_n(xml_s, &len);
+       const char *s = origs;
        if (*s != '\n') {
                char *edatastr;
                // We buffer up characters in 'cdatastr' until a single <lf> is received
@@ -304,7 +305,7 @@ ce_cdata(void *dta, const XML_Char *xml_s, int len)
                cdatastr[0] = '\0';
        }
 
-       xml_free_converted_string(s);
+       xml_free_converted_string(origs);
 }
 
 /* Set up reading the CE input file */
index 9923641532d1cd9052214907816986d5ce98d1da..be4b2fa17de84d337e5de6f1f3922bd5b5e91f58 100644 (file)
@@ -58,6 +58,7 @@
 #include "defs.h"
 #include "csv_util.h"
 
+#if CSVFMTS_ENABLED
 #include <ctype.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -637,3 +638,4 @@ ff_vecs_t compegps_vecs = {
        compegps_args,
        CET_CHARSET_MS_ANSI, 1
 };
+#endif /* CSVFMTS_ENABLED */
index 10b5f9b901f55d066166f5930e8a17b49e5dbda3..29441673cc5bd93db99bdb4a71291d3966031f91 100644 (file)
@@ -3,6 +3,12 @@
 /* 0 for most-used character sets */
 #undef CET_WANTED
 
+/* 1 to enable the CSV formats support */
+#undef CSVFMTS_ENABLED
+
+/* 1 to enable all the filters. */
+#undef FILTERS_ENABLED
+
 /* Defined if you have libexpat */
 #undef HAVE_LIBEXPAT
 
index a98bb78ccbe9e31dbb1776ca079be6ff7fcf6a5b..6798e0f99172ab216d5b55c8b75bd8ef1888ad53 100755 (executable)
@@ -804,10 +804,20 @@ if test -n "$ac_init_help"; then
    esac
   cat <<\_ACEOF
 
+Optional Features:
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --enable-shapefile=(yes)|no
+  --enable-pdb=(yes)|no
+  --enable-csv=(yes)|no
+  --enable-filters=(yes)|no
+
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
---with-cet=(default,all,minimal)
+  --with-cet=(default,all,minimal)
+  --with-expathdr=DIR   Use this to specify the location of expat.h
+  --with-libexpat=DIR   Use this to specify expat library .
 
 Some influential environment variables:
   CC          C compiler command
@@ -2521,16 +2531,94 @@ _ACEOF
 
 fi
 
+echo "$as_me:$LINENO: checking whether to support shapefiles" >&5
+echo $ECHO_N "checking whether to support shapefiles... $ECHO_C" >&6
+# Check whether --enable-shapefile or --disable-shapefile was given.
+if test "${enable_shapefile+set}" = set; then
+  enableval="$enable_shapefile"
+   enable_shapefile="$enableval"
+else
+  enable_shapefile="yes"
+fi;
+    if test "$enable_shapefile" != "no" ; then
 
 cat >>confdefs.h <<\_ACEOF
 #define SHAPELIB_ENABLED 1
 _ACEOF
 
+       echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+    else
+       echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+    fi
+
+echo "$as_me:$LINENO: checking whether to support Palm/OS pdb formats" >&5
+echo $ECHO_N "checking whether to support Palm/OS pdb formats... $ECHO_C" >&6
+# Check whether --enable-pdb or --disable-pdb was given.
+if test "${enable_pdb+set}" = set; then
+  enableval="$enable_pdb"
+   enable_pdb="$enableval"
+else
+  enable_pdb="yes"
+fi;
+    if test "$enable_pdb" != "no" ; then
 
 cat >>confdefs.h <<\_ACEOF
 #define PDBFMTS_ENABLED 1
 _ACEOF
 
+       echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+    else
+       echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+    fi
+
+echo "$as_me:$LINENO: checking whether to support csv formats" >&5
+echo $ECHO_N "checking whether to support csv formats... $ECHO_C" >&6
+# Check whether --enable-csv or --disable-csv was given.
+if test "${enable_csv+set}" = set; then
+  enableval="$enable_csv"
+   enable_csv="$enableval"
+else
+  enable_csv="yes"
+fi;
+    if test "$enable_csv" != "no" ; then
+
+cat >>confdefs.h <<\_ACEOF
+#define CSVFMTS_ENABLED 1
+_ACEOF
+
+       echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+    else
+       echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+    fi
+
+echo "$as_me:$LINENO: checking whether to support csv formats" >&5
+echo $ECHO_N "checking whether to support csv formats... $ECHO_C" >&6
+# Check whether --enable-filters or --disable-filters was given.
+if test "${enable_filters+set}" = set; then
+  enableval="$enable_filters"
+   enable_filters="$enableval"
+else
+  enable_filters="yes"
+fi;
+    if test "$enable_filters" != "no" ; then
+
+cat >>confdefs.h <<\_ACEOF
+#define FILTERS_ENABLED 1
+_ACEOF
+
+       echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+    else
+       echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+    fi
+
 
 case "$target" in
     *-*-cygwin* | *-*-mingw32*)
@@ -2705,30 +2793,55 @@ echo $ECHO_N "checking for random stuff to make you feel better... $ECHO_C" >&6
 echo "$as_me:$LINENO: result: failed" >&5
 echo "${ECHO_T}failed" >&6
 
-echo "$as_me:$LINENO: checking for libexpat" >&5
-echo $ECHO_N "checking for libexpat... $ECHO_C" >&6
-if test "$with_libexpat" = no ; then
-       echo "$as_me:$LINENO: result: check not done" >&5
-echo "${ECHO_T}check not done" >&6
+
+# Check whether --with-expathdr or --without-expathdr was given.
+if test "${with_expathdr+set}" = set; then
+  withval="$with_expathdr"
+   xpathdr="$withval"
 else
 
-# Special case fink test.
        case "$target" in
        *-*-darwin*)
-               if test -f /sw/include/expat.h -a -f /sw/include/expat.h; then
-                       CFLAGS="$CFLAGS -I/sw/include"
-                       LDFLAGS="$LDFLAGS -L/sw/lib"
-                       # Static link against expat archive, not dyn lib.
+               if test -f /sw/include/expat.h ; then
+                       xpathdr=/sw/include/
+               fi
+               ;;
+       *)      ;;
+       esac
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_LIBEXPAT 1
-_ACEOF
 
+fi;
+
+if test "x-$xpathdr " != "x-" ; then
+       CFLAGS="$CFLAGS -I$xpathdr"
+fi
+
+echo "$as_me:$LINENO: checking for libexpat" >&5
+echo $ECHO_N "checking for libexpat... $ECHO_C" >&6
+
+# Check whether --with-libexpat or --without-libexpat was given.
+if test "${with_libexpat+set}" = set; then
+  withval="$with_libexpat"
+   EXPAT_LIB="-L$withval -lexpat"
+else
+
+       case "$target" in
+       *-*-darwin*)
+               if test -f /sw/lib/libexpat.a ; then
                        EXPAT_LIB=/sw/lib/libexpat.a
                fi
                ;;
        *)
-               echo "$as_me:$LINENO: checking for XML_ParserCreate in -lexpat" >&5
+                       EXPAT_LIB=-lexpat
+               ;;
+       esac
+
+
+fi;
+echo "$as_me:$LINENO: result: $EXPAT_LIB" >&5
+echo "${ECHO_T}$EXPAT_LIB" >&6
+
+echo "$as_me:$LINENO: checking for XML_ParserCreate in -lexpat" >&5
 echo $ECHO_N "checking for XML_ParserCreate in -lexpat... $ECHO_C" >&6
 if test "${ac_cv_lib_expat_XML_ParserCreate+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -2798,14 +2911,12 @@ cat >>confdefs.h <<\_ACEOF
 #define HAVE_LIBEXPAT 1
 _ACEOF
 
-                       EXPAT_LIB="$LDFLAGS -lexpat"
-fi
 
+#  [EXPAT_LIB="$LDFLAGS -lexpat"]
 
-               ;;
-       esac
 fi
 
+echo $EXPAT_LIB
 
 # Checks for header files.
 # AC_HEADER_STDC
index 7972445502529cb7a46042570e40f0eb8df602d9..2067ea677ad1a6b3f1c009d6dad408a0e81c6222 100644 (file)
@@ -20,7 +20,7 @@ AC_SUBST(AC_EXEEXT)
 # Checks for libraries.
 AC_CHECK_LIB([m], [cos])
 
-AC_ARG_WITH(cet,[--with-cet=(default,all,minimal)],
+AC_ARG_WITH(cet,[  --with-cet=(default,all,minimal)],
              cet="$withval", cet="default")
 
 if test "$cet" = "all"; then
@@ -30,8 +30,50 @@ if test "$cet" = "default"; then
    AC_DEFINE(CET_WANTED, 0, [0 for most-used character sets])
 fi
 
-AC_DEFINE(SHAPELIB_ENABLED, 1, [1 to enable shapefile support])
-AC_DEFINE(PDBFMTS_ENABLED, 1, [1 to enable Palm PDB support])
+AC_MSG_CHECKING(whether to support shapefiles)
+AC_ARG_ENABLE(shapefile,
+  [  --enable-shapefile=[(yes)|no]],
+  [ enable_shapefile="$enableval"],[enable_shapefile="yes"])
+    if test "$enable_shapefile" != "no" ; then
+        AC_DEFINE(SHAPELIB_ENABLED, 1, [1 to enable shapefile support])
+       AC_MSG_RESULT(yes)
+    else
+       AC_MSG_RESULT(no)
+    fi
+
+AC_MSG_CHECKING(whether to support Palm/OS pdb formats)
+AC_ARG_ENABLE(pdb,
+  [  --enable-pdb=[(yes)|no]],
+  [ enable_pdb="$enableval"],[enable_pdb="yes"])
+    if test "$enable_pdb" != "no" ; then
+        AC_DEFINE(PDBFMTS_ENABLED, 1, [1 to enable Palm PDB support])
+       AC_MSG_RESULT(yes)
+    else
+       AC_MSG_RESULT(no)
+    fi
+
+AC_MSG_CHECKING(whether to support csv formats)
+AC_ARG_ENABLE(csv,
+  [  --enable-csv=[(yes)|no]],
+  [ enable_csv="$enableval"],[enable_csv="yes"])
+    if test "$enable_csv" != "no" ; then
+        AC_DEFINE(CSVFMTS_ENABLED, 1, [1 to enable the CSV formats support])
+       AC_MSG_RESULT(yes)
+    else
+       AC_MSG_RESULT(no)
+    fi
+
+AC_MSG_CHECKING(whether to support csv formats)
+AC_ARG_ENABLE(filters,
+  [  --enable-filters=[(yes)|no]],
+  [ enable_filters="$enableval"],[enable_filters="yes"])
+    if test "$enable_filters" != "no" ; then
+       AC_DEFINE(FILTERS_ENABLED, 1, [1 to enable all the filters.])
+       AC_MSG_RESULT(yes)
+    else
+       AC_MSG_RESULT(no)
+    fi
+
 
 case "$target" in
     *-*-cygwin* | *-*-mingw32*)
@@ -91,31 +133,48 @@ AC_SUBST(GBSER)
 AC_MSG_CHECKING(for random stuff to make you feel better)
 AC_MSG_RESULT(failed)
 
-AC_MSG_CHECKING(for libexpat)
-if test "$with_libexpat" = no ; then
-       AC_MSG_RESULT(check not done)
-else
+AC_ARG_WITH(expathdr,
+  [  --with-expathdr[=DIR]   Use this to specify the location of expat.h],
+  [ xpathdr="$withval" ], [
+       case "$target" in
+       *-*-darwin*)
+               if test -f /sw/include/expat.h ; then
+                       xpathdr=/sw/include/
+               fi
+               ;;
+       *)      ;;
+       esac
+]
+)
+
+if test "x-$xpathdr " != "x-" ; then
+       CFLAGS="$CFLAGS -I$xpathdr"
+fi
 
-# Special case fink test.
+AC_MSG_CHECKING(for libexpat)
+AC_ARG_WITH(libexpat,
+  [  --with-libexpat[=DIR]   Use this to specify expat library .],
+  [ EXPAT_LIB="-L$withval -lexpat"], [
        case "$target" in
        *-*-darwin*)
-               if test -f /sw/include/expat.h -a -f /sw/include/expat.h; then
-                       CFLAGS="$CFLAGS -I/sw/include"
-                       LDFLAGS="$LDFLAGS -L/sw/lib"
-                       # Static link against expat archive, not dyn lib.
-                       AC_DEFINE(HAVE_LIBEXPAT, 1, [Defined if you have libexpat])
+               if test -f /sw/lib/libexpat.a ; then
                        EXPAT_LIB=/sw/lib/libexpat.a
                fi
                ;;
        *)
-               AC_CHECK_LIB([expat], [XML_ParserCreate], 
-                       AC_DEFINE(HAVE_LIBEXPAT, 1, [Defined if you have libexpat])
-                       [EXPAT_LIB="$LDFLAGS -lexpat"])
-
+                       EXPAT_LIB=-lexpat
                ;;
        esac
-fi
-AC_SUBST(EXPAT_LIB)
+  ]
+)
+AC_MSG_RESULT($EXPAT_LIB)
+
+AC_CHECK_LIB([expat], [XML_ParserCreate], 
+  AC_DEFINE(HAVE_LIBEXPAT, 1, [Defined if you have libexpat])
+  AC_SUBST(EXPAT_LIB)
+#  [EXPAT_LIB="$LDFLAGS -lexpat"]
+)
+echo $EXPAT_LIB
 
 # Checks for header files.
 # AC_HEADER_STDC
index b1d172e5f0c2f59a4899e62fc30b96a80f8dbbf6..51a90ae30f97a3219e536a9c7afe126a6554666d 100644 (file)
@@ -280,6 +280,7 @@ csv_lineparse(const char *stringstart, const char *delimited_by,
     return (tmp);
 }
 
+#if CSVFMTS_ENABLED
 /*****************************************************************************/
 /* dec_to_intdeg() - convert decimal degrees to integer degreees             */
 /*    usage: i = dec_to_intdeg(31.1234, 1);                                  */
@@ -351,7 +352,7 @@ decdir_to_dec(const char * decdir)
     
     return(rval * sign);
 }
-
+#endif
 
 /*****************************************************************************
  * human_to_dec() - convert a "human-readable" lat and/or lon to decimal
@@ -482,6 +483,7 @@ human_to_dec( const char *instr, double *outlat, double *outlon, int which )
     }
 }
 
+#if CSVFMTS_ENABLED
 /*
  * dec_to_human - convert decimal degrees to human readable
  */
@@ -1514,4 +1516,4 @@ xcsv_data_write(void)
         fprintf (xcsv_file.xcsvfp, "%s%s", ogp->val, xcsv_file.record_delimiter);
     }
 }
-
+#endif
index 045c12112d880c46bc2723c1416a64b226442775..1b69c8c86311ca842e14e881e45cb8c4f43b6cbe 100644 (file)
@@ -22,6 +22,7 @@
 #include "defs.h"
 #include "filterdefs.h"
 
+#if FILTERS_ENABLED
 static char *hdopopt = NULL;
 static char *vdopopt = NULL;
 static char *andopt = NULL;
@@ -114,3 +115,4 @@ filter_vecs_t discard_vecs = {
        NULL,
        fix_args
 };
+#endif
index bc5da9107c4f26c303dffd7c5e453b1af68e79ab..f40e1bf5fb3b997f608d9b6beeae1aba54ea8ce6 100644 (file)
@@ -22,6 +22,7 @@
 #include "defs.h"
 #include "filterdefs.h"
 
+#if FILTERS_ENABLED
 static char *snopt = NULL;
 static char *lcopt = NULL;
 static char *purge_duplicates = NULL;
@@ -256,3 +257,4 @@ filter_vecs_t duplicate_vecs = {
        NULL,
        dup_args
 };
+#endif
index 23163c422b9911f640297d22801adcd2eac2b6f3..2dc2f42a8d4631490aff08d69878830edfefdc83 100644 (file)
@@ -45,41 +45,52 @@ extern filter_vecs_t interpolatefilt_vecs;
 
 static
 fl_vecs_t filter_vec_list[] = {
+#if FILTERS_ENABLED
+        {
+               &arcdist_vecs,
+               "arc",
+               "Include Only Points Within Distance of Arc",
+       },
        {
-               &position_vecs, 
-               "position",
-               "Remove Points Within Distance",
-       }, 
-       {
-               &radius_vecs, 
-               "radius",
-               "Include Only Points Within Radius",
-       }, 
+               &discard_vecs,
+               "discard",
+               "Remove unreliable points with high hdop or vdop"
+       },
        {
                &duplicate_vecs, 
                "duplicate",
                "Remove Duplicates",
        },
-        {
-               &arcdist_vecs,
-               "arc",
-               "Include Only Points Within Distance of Arc",
+       {
+               &interpolatefilt_vecs,
+               "interpolate",
+               "Interpolate between trackpoints"
+       },
+       {
+               &nuke_vecs,
+               "nuketypes",
+               "Remove all waypoints, tracks, or routes"
        },
        {
                &polygon_vecs,
                "polygon",
                "Include Only Points Inside Polygon",
        },
+       {
+               &position_vecs, 
+               "position",
+               "Remove Points Within Distance",
+       }, 
+       {
+               &radius_vecs, 
+               "radius",
+               "Include Only Points Within Radius",
+       }, 
        {
                &routesimple_vecs,
                "simplify",
                "Simplify routes",
        },
-       {
-               &reverse_route_vecs,
-               "reverse",
-               "Reverse stops within routes",
-       },
        {
                &sort_vecs,
                "sort",
@@ -90,26 +101,17 @@ fl_vecs_t filter_vec_list[] = {
                "stack",
                "Save and restore waypoint lists"
        },
+       {
+               &reverse_route_vecs,
+               "reverse",
+               "Reverse stops within routes",
+       },
        {
                &trackfilter_vecs,
                "track",
                "Manipulate track lists"
        },
-       {
-               &discard_vecs,
-               "discard",
-               "Remove unreliable points with high hdop or vdop"
-       },
-       {
-               &nuke_vecs,
-               "nuketypes",
-               "Remove all waypoints, tracks, or routes"
-       },
-       {
-               &interpolatefilt_vecs,
-               "interpolate",
-               "Interpolate between trackpoints"
-       },
+#endif
         {
                NULL,
                NULL,
index 06030623bed00ab7684c40f94d02a181ec71fbc6..b054747b0814667aeb488f40b0c2b54894331fbd 100644 (file)
@@ -173,41 +173,15 @@ icon_mapping_t garmin_icon_table[] = {
        {    35,    36, "White Dot" },
        {    88,  8219, "Zoo" },
 
-       /* These are experimental and for the custom icons in the new "C"
-        * models.   As of this writing, firmware problems impair their 
-        * general use.   
-        * 
-        * "Quest" supports more icons than this, but other problems
-        * prohibit us from running with that model, so we stop at 24.
-        * 
-        * Mapsource doesn't yet know how to do these, so we made the icon
-        * numbers "-2" to signify that as a problem until we can create
-        * these in a .mps or .gdb file and see their representation there.
+       /* Custom icons.   The spec reserves 7680-8191 for the custom
+        * icons on the C units, Quest, 27xx, 276, 296,  and other units.
+        * Note that firmware problems on the earlier unit result in these
+        * being mangled, so be sure you're on a version from at least 
+        * late 2005.
+        * {    -2,  7680, "Custom 0" },
+        * ....
+        * {    -2,  8192, "Custom 511" },
         */
-       {    -2,  7680, "Custom 0" },
-       {    -2,  7681, "Custom 1" },
-       {    -2,  7682, "Custom 2" },
-       {    -2,  7683, "Custom 3" },
-       {    -2,  7684, "Custom 4" },
-       {    -2,  7685, "Custom 5" },
-       {    -2,  7686, "Custom 6" },
-       {    -2,  7687, "Custom 7" },
-       {    -2,  7688, "Custom 8" },
-       {    -2,  7689, "Custom 9" },
-       {    -2,  7690, "Custom 10" },
-       {    -2,  7691, "Custom 11" },
-       {    -2,  7692, "Custom 12" },
-       {    -2,  7693, "Custom 13" },
-       {    -2,  7694, "Custom 14" },
-       {    -2,  7695, "Custom 15" },
-       {    -2,  7696, "Custom 16" },
-       {    -2,  7697, "Custom 17" },
-       {    -2,  7698, "Custom 18" },
-       {    -2,  7699, "Custom 19" },
-       {    -2,  7700, "Custom 20" },
-       {    -2,  7701, "Custom 21" },
-       {    -2,  7702, "Custom 22" },
-       {    -2,  7703, "Custom 23" },
 
        {    92,  8227, "Micro-Cache" },        /* icon for "Toll Booth" */
        {    48,   161, "Virtual cache" },      /* icon for "Scenic Area" */
@@ -544,7 +518,7 @@ char *
 gt_find_desc_from_icon_number(const int icon, garmin_formats_e garmin_format, int *dynamic)
 {
        icon_mapping_t *i;
-       char custom[] = "Custom 63";
+       char custom[] = "Custom 63 ";
 
        if ((garmin_format == GDB) && (icon >= 500) && (icon <= 563))
        {
@@ -553,6 +527,12 @@ gt_find_desc_from_icon_number(const int icon, garmin_formats_e garmin_format, in
                return xstrdup(custom);
        }
 
+       if ((garmin_format == PCX) && (icon >= 7680) && (icon <= 8191)) {
+               snprintf(custom, sizeof(custom), "Custom %d", icon - 7680);
+               *dynamic = 1;
+               return xstrdup(custom);
+       }
+
        if (dynamic) *dynamic = 0;
        
        for (i = garmin_icon_table; i->icon; i++) {
@@ -592,11 +572,16 @@ int gt_find_icon_number_from_desc(const char *desc, garmin_formats_e garmin_form
                return n;
        }
 
-       if ((garmin_format == GDB) && (case_ignore_strncmp(desc, "Custom ", 7) == 0)) {
-               n = atoi((char *)desc + 7);
-               if ((n >= 0) && (n <= 63))
-                       return n+500;
+       if (0 == case_ignore_strncmp(desc, "Custom ", 7)) {
+               int base = 0;
+               if (garmin_format == GDB) base = 500;
+               if (garmin_format == PCX) base = 7680;
+               if (base) {
+                       n = atoi(&desc[7]);
+                       return n + base;
+               }
        }
+
        for (i = garmin_icon_table; i->icon; i++) {
                if (case_ignore_strcmp(desc,i->icon) == 0) {
                        switch (garmin_format) {
index caeea30b5a9eaa91352de3a141c86e3ede1d171a..e8090943cecf1fd478f1d8c52ca03fc17b3b7258 100644 (file)
@@ -22,6 +22,7 @@
  
 #include "defs.h"
 
+#if CSVFMTS_ENABLED
 #include <math.h>
 #include <time.h>
 #include <ctype.h>
@@ -500,7 +501,8 @@ print_categories(gbuint16 categories)
                                
                        fprintf(fout, "%s", (count++ > 0) ? "," : "");
                        if (c == NULL)
-                               fprintf(fout, "Category %d", i+1);
+//                             fprintf(fout, "Category %d", i+1);
+                               fprintf(fout, "%s", gps_categories[i]);
                        else
                                fprintf(fout, "%s", c);
                        
@@ -1388,3 +1390,5 @@ ff_vecs_t garmin_txt_vecs = {
        garmin_txt_args,
        CET_CHARSET_MS_ANSI, 0
 };
+
+#endif // CSVFMTS_ENABLED
index 348e05f5743fb914439f4a4afd85e045648cee99..062950bb437dc8ad45fefddb85da48e5a87b7db7 100644 (file)
@@ -1047,13 +1047,14 @@ gpx_rd_deinit(void)
 #else /* NO_EXPAT */
 
 static void
-gpx_cdata(void *dta, const XML_Char *s, int len)
+gpx_cdata(void *dta, const XML_Char *xml_el, int len)
 {
        char *estr;
        int *cdatalen;
        char **cdata;
        xml_tag *tmp_tag;
        size_t slen = strlen(cdatastr.mem);
+       const char *s = xml_convert_to_char_string_n(xml_el, &len);
 
        vmem_realloc(&cdatastr,  1 + len + slen);
        estr = ((char *) cdatastr.mem) + slen;
@@ -1085,6 +1086,8 @@ gpx_cdata(void *dta, const XML_Char *s, int len)
                memcpy( estr, s, len );
                *(estr+len) = '\0';
                *cdatalen += len;
+
+       xml_free_converted_string(s);
 }
 
 static void
index ab4e2cf4148e507a7beaa66d13b70dc43081d3ee..69dc534b0957ae4267b79fd80a79374c8d247f9f 100644 (file)
@@ -1,6 +1,8 @@
 /* This file is machine-generated from the contents of style/ */
 /* by mkstyle.sh.   Editing it by hand is an exeedingly bad idea. */
 
+#include "defs.h"
+#if CSVFMTS_ENABLED
 static char arc[] = 
 "# gpsbabel XCSV style file\n"
 "#\n"
@@ -851,6 +853,40 @@ static char tabsep[] =
 "IFIELD  GEOCACHE_PLACER,\"\",\"%s\"\n"
 "IFIELD  YYYYMMDD_TIME,\"\",\"%ld\"\n"
 ;
+static char xmap[] = 
+"# gpsbabel XCSV style file\n"
+"#\n"
+"# Format: DeLorme Xmap Conduit\n"
+"# Author: Alex Mottram\n"
+"#   Date: 12/09/2002\n"
+"#\n"
+"# \n"
+"# As defined in csv.c/xmap\n"
+"#\n"
+
+"DESCRIPTION           DeLorme XMap HH Native .WPT\n"
+"EXTENSION             wpt\n"
+
+"#\n"
+"# FILE LAYOUT DEFINITIIONS:\n"
+"#\n"
+"FIELD_DELIMITER               COMMASPACE\n"
+"RECORD_DELIMITER      NEWLINE\n"
+"BADCHARS              COMMA\n"
+
+"PROLOGUE      BEGIN SYMBOL\n"
+"EPILOGUE      END\n"
+"#\n"
+"# INDIVIDUAL DATA FIELDS, IN ORDER OF APPEARANCE:\n"
+"#\n"
+"IFIELD        LAT_HUMAN_READABLE, \"\", \"%08.5f\"\n"
+"IFIELD        LON_HUMAN_READABLE, \"\", \"%08.5f\"\n"
+"IFIELD        DESCRIPTION, \"\", \"%s\"\n"
+
+"OFIELD        LAT_DECIMAL, \"\", \"%08.5f\"\n"
+"OFIELD        LON_DECIMAL, \"\", \"%08.5f\"\n"
+"OFIELD        DESCRIPTION, \"\", \"%s\"\n"
+;
 static char xmap2006[] = 
 "# gpsbabel XCSV style file\n"
 "#\n"
@@ -889,40 +925,6 @@ static char xmap2006[] =
 
 
 
-;
-static char xmap[] = 
-"# gpsbabel XCSV style file\n"
-"#\n"
-"# Format: DeLorme Xmap Conduit\n"
-"# Author: Alex Mottram\n"
-"#   Date: 12/09/2002\n"
-"#\n"
-"# \n"
-"# As defined in csv.c/xmap\n"
-"#\n"
-
-"DESCRIPTION           DeLorme XMap HH Native .WPT\n"
-"EXTENSION             wpt\n"
-
-"#\n"
-"# FILE LAYOUT DEFINITIIONS:\n"
-"#\n"
-"FIELD_DELIMITER               COMMASPACE\n"
-"RECORD_DELIMITER      NEWLINE\n"
-"BADCHARS              COMMA\n"
-
-"PROLOGUE      BEGIN SYMBOL\n"
-"EPILOGUE      END\n"
-"#\n"
-"# INDIVIDUAL DATA FIELDS, IN ORDER OF APPEARANCE:\n"
-"#\n"
-"IFIELD        LAT_HUMAN_READABLE, \"\", \"%08.5f\"\n"
-"IFIELD        LON_HUMAN_READABLE, \"\", \"%08.5f\"\n"
-"IFIELD        DESCRIPTION, \"\", \"%s\"\n"
-
-"OFIELD        LAT_DECIMAL, \"\", \"%08.5f\"\n"
-"OFIELD        LON_DECIMAL, \"\", \"%08.5f\"\n"
-"OFIELD        DESCRIPTION, \"\", \"%s\"\n"
 ;
 static char xmapwpt[] = 
 "# gpsbabel XCSV style file\n"
@@ -956,6 +958,9 @@ static char xmapwpt[] =
 "IFIELD        IGNORE, \"\", \"%-.31s\"\n"
 "IFIELD        DESCRIPTION, \"\", \"%-.78s\"\n"
 ;
-#include "defs.h"
-style_vecs_t style_list[] = {{ "xmapwpt", xmapwpt } , { "xmap", xmap } , { "xmap2006", xmap2006 } , { "tabsep", tabsep } , { "saplus", saplus } , { "s_and_t", s_and_t } , { "openoffice", openoffice } , { "nima", nima } , { "mxf", mxf } , { "mapconverter", mapconverter } , { "kwf2", kwf2 } , { "ktf2", ktf2 } , { "gpsman", gpsman } , { "gpsdrivetrack", gpsdrivetrack } , { "gpsdrive", gpsdrive } , { "geonet", geonet } , { "garmin_poi", garmin_poi } , { "garmin301", garmin301 } , { "fugawi", fugawi } , { "dna", dna } , { "custom", custom } , { "cup", cup } , { "csv", csv } , { "cambridge", cambridge } , { "arc", arc } ,  {0,0}};
+style_vecs_t style_list[] = {{ "xmapwpt", xmapwpt } , { "xmap2006", xmap2006 } , { "xmap", xmap } , { "tabsep", tabsep } , { "saplus", saplus } , { "s_and_t", s_and_t } , { "openoffice", openoffice } , { "nima", nima } , { "mxf", mxf } , { "mapconverter", mapconverter } , { "kwf2", kwf2 } , { "ktf2", ktf2 } , { "gpsman", gpsman } , { "gpsdrivetrack", gpsdrivetrack } , { "gpsdrive", gpsdrive } , { "geonet", geonet } , { "garmin_poi", garmin_poi } , { "garmin301", garmin301 } , { "fugawi", fugawi } , { "dna", dna } , { "custom", custom } , { "cup", cup } , { "csv", csv } , { "cambridge", cambridge } , { "arc", arc } ,  {0,0}};
 size_t nstyles = 25;
+#else /* CSVFMTS_ENABLED */
+style_vecs_t style_list[] = {{0,0}};
+size_t nstyles = 0;
+#endif /* CSVFMTS_ENABLED */
index 189750d3c7765b74f1292b9bd13629aee8271d80..fe4659d27c75863803b45234b66a01b2e89511ab 100644 (file)
@@ -23,6 +23,7 @@
 #include "filterdefs.h"
 #include "grtcirc.h"
 
+#if FILTERS_ENABLED
 #define MYNAME "Interpolate filter"
 
 static char *opt_interval = NULL;
@@ -162,3 +163,4 @@ filter_vecs_t interpolatefilt_vecs = {
        NULL,
        interpfilt_args
 };
+#endif FILTERS_ENABLED
index 35062287b5fe84bd08e807638b8f29dbf458a64c..e307b3aba0360b59bdc3af4d04e2a751a5c7f0de 100644 (file)
@@ -33,6 +33,7 @@ extern int32 gps_warning;
 extern int32 gps_error;
 extern int32 gps_user;
 extern int32 gps_show_bytes;
+extern char gps_categories[16][17];
 
 
 typedef struct GPS_SPacket
index 08e4ee7a09cfcf981f33797a995816f9a9fb2d6d..204d198b9511127cb4690cf89393d87ab8594ae6 100644 (file)
@@ -1713,7 +1713,7 @@ static void GPS_D155_Get(GPS_PWay *way, UC *s)
  * as of this writing for no data type exposes more than 16 bits in the
  * bitmask of categories.  
  */
-static char categories[16][17];
+char gps_categories[16][17];
 /* 
  * Read descriptor s into category number N;
  */
@@ -1728,9 +1728,9 @@ void GPS_D120_Get(int cat_num, char *s)
         */
 
        if (*s) {
-               strncpy(categories[cat_num], s, sizeof (categories[0]));
+               strncpy(gps_categories[cat_num], s, sizeof (gps_categories[0]));
        } else {
-               snprintf(categories[cat_num], sizeof (categories[0]), 
+               snprintf(gps_categories[cat_num], sizeof (gps_categories[0]), 
                        "Category %d", cat_num+1);
        }
 }
index cea6fe3abfe4c8c7588862a5cf7e3d1424fb6997..32837c31cf48d06a1af7f1f8744573e349f3f678 100644 (file)
@@ -7,7 +7,7 @@ FILES=gpsbabel.exe libexpat.dll ../win32/GPSBabelGUI.exe ../win32/gui-2/README.g
 gpsbabel.exe:  wintesto.cmd
 
 include ../Makefile
-CFLAGS=-Iinclude -I../coldsync -O $(INHIBIT_USB)
+CFLAGS=-Iinclude -I../coldsync -O $(INHIBIT_USB) $(EXTRA_CFLAGS)
 #
 # Must define empty (don't comment out the whole line) if you want to 
 # override INHIBIT_USB from the parent Makefile.
index 418e60f05052ca4046fa7c33512019dcc80951ab..19db383a3525d3f37e2dc58adc8d4392fe7f00d0 100755 (executable)
@@ -3,6 +3,8 @@ echo "/* This file is machine-generated from the contents of style/ */"
 echo "/* by mkstyle.sh.   Editing it by hand is an exeedingly bad idea. */"
 echo 
 
+echo "#include \"defs.h\""
+echo "#if CSVFMTS_ENABLED"
 nstyles="0"
 for i in style/*.style
 do
@@ -15,7 +17,10 @@ do
        echo ";"
        nstyles=`expr $nstyles + 1`;
 done
-
-echo "#include \"defs.h\""
 echo "style_vecs_t style_list[] = {$ALIST {0,0}};"
 echo "size_t nstyles = $nstyles;"
+echo "#else /* CSVFMTS_ENABLED */"
+echo "style_vecs_t style_list[] = {{0,0}};"
+echo "size_t nstyles = 0;"
+echo "#endif /* CSVFMTS_ENABLED */"
+
index 516ad740980abc1a8606a1bf4abbd34e7a5b0c67..6dc8fccbb0d41a5b240944e7200ec59e4d79b335 100644 (file)
@@ -23,6 +23,7 @@
 #include "defs.h"
 #include "filterdefs.h"
 
+#if FILTERS_ENABLED
 #define MYNAME "nukedata"
 
 static char *nukewpts, *nuketrks, *nukertes;
@@ -60,3 +61,4 @@ filter_vecs_t nuke_vecs = {
        nuke_args
 };
 
+#endif
index 6a4a652d992a49b024ef914b978a823af65e7636..c19488d926a79e4068cf3711a17b00f9b101a772 100644 (file)
@@ -21,6 +21,7 @@
 #include "defs.h"
 #include "filterdefs.h"
 
+#if FILTERS_ENABLED
 #define MYNAME "Polygon filter"
 
 static char *polyfileopt = NULL;
@@ -295,3 +296,4 @@ filter_vecs_t polygon_vecs = {
        NULL,
        polygon_args
 };
+#endif // FILTERS_ENABLED
index 25f6f7d414e37442b915d559cef636110790a661..c9b12d9e701287082e1b0fcab3f7f47d5c35aa1d 100644 (file)
@@ -22,6 +22,8 @@
 #include "filterdefs.h"
 #include "grtcirc.h"
 
+#if FILTERS_ENABLED
+
 #ifndef M_PI
 #  define M_PI 3.14159265358979323846
 #endif
@@ -414,3 +416,4 @@ filter_vecs_t radius_vecs = {
        NULL,
        radius_args
 };
+#endif // FILTERS_ENABLED
index 6bc204f2ea2df0b5d435bb0f7f8a79fc98bea142..5636cf6fa84928533c1f4199748def170e602645 100644 (file)
@@ -21,6 +21,8 @@
 #include "defs.h"
 #include "filterdefs.h"
 
+#if FILTERS_ENABLED
+
 #define MYNAME "Route reversal filter"
 
 static
@@ -65,3 +67,4 @@ filter_vecs_t reverse_route_vecs = {
        NULL,
        reverse_route_args
 };
+#endif
index 790faa29985410b0d7c6d472e9e79da27283fe05..fa8d7e51936c5c56037ed323347835d8fcf69c63 100644 (file)
@@ -21,6 +21,8 @@
 #include "defs.h"
 #include "filterdefs.h"
 
+#if FILTERS_ENABLED
+
 typedef enum {
        sm_unknown = 0,
        sm_gcid,
@@ -111,3 +113,4 @@ filter_vecs_t sort_vecs = {
        NULL,
        sort_args
 };
+#endif FILTERS_ENABLED
index 137e85b506ecdd3519741572391ab2b30f87c209..e8bbf71e62da018154c0e454d011a228f231ec3c 100644 (file)
@@ -22,6 +22,8 @@
 #include "defs.h"
 #include "filterdefs.h"
 
+#if FILTERS_ENABLED
+
 #define MYNAME "Stack filter"
 
 static char *opt_push = NULL;
@@ -244,3 +246,5 @@ filter_vecs_t stackfilt_vecs = {
        stackfilt_exit,
        stackfilt_args
 };
+
+#endif // FILTERS_ENABLED
index ef4bf3c8946e71c77ee5108d79092a62b45d8122..00c7748ae87e892bc1bee718cf5957f4dac30f92 100644 (file)
@@ -19,7 +19,6 @@
     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA
 
  */
  /* 
     2005-07-20: implemented interval option from Etienne Tasse
     2005-07-26: implemented range option
@@ -38,6 +37,7 @@
 #include "strptime.h"
 #include "grtcirc.h"
 
+#if FILTERS_ENABLED
 #define MYNAME "trackfilter"
 
 #define TRACKFILTER_PACK_OPTION                "pack"
@@ -870,3 +870,4 @@ filter_vecs_t trackfilter_vecs = {
 };
 
 /******************************************************************************************/
+#endif // FILTERS_ENABLED
index fa96a7ab6201fd6085d4c32019b73efc34f44cb6..6c00fde61cd0b59b75c1c508c50b081cd8f179a6 100644 (file)
@@ -106,6 +106,7 @@ extern ff_vecs_t yahoo_vecs;
 
 static
 vecs_t vec_list[] = {
+#if CSVFMTS_ENABLED
        /* XCSV must be the first entry in this table. */
        {
                &xcsv_vecs,
@@ -113,6 +114,7 @@ vecs_t vec_list[] = {
                "? Character Separated Values",
                NULL
        },
+#endif
        {
                &geo_vecs, 
                "geo",
@@ -513,12 +515,14 @@ vecs_t vec_list[] = {
                "pdb"
        },
 #endif
+#if CSVFMTS_ENABLED
        {
                &compegps_vecs,
                "compegps",
                "CompeGPS data files (.wpt/.trk/.rte)",
                NULL
        },
+#endif //CSVFMTS_ENABLED
        {
                &yahoo_vecs,
                "yahoo",
@@ -537,12 +541,14 @@ vecs_t vec_list[] = {
                "GPS TrackMaker",
                "gtm"
        },
+#if CSVFMTS_ENABLED
         {
                &garmin_txt_vecs,
                "garmin_txt",
                "Garmin MapSource - txt (tab delimited)",
                "txt"
        },
+#endif // CSVFMTS_ENABLED
         {
                &axim_gpb_vecs,
                "axim_gpb",
@@ -669,6 +675,10 @@ find_vec(char *const vecname, char **opts)
        char *svecname = strtok(v, ",");
        int found = 0;
 
+       if (vecname == NULL) {
+               fatal("A format name is required.\n");
+       }
+
        while (vec->vec) {
                arglist_t *ap;
                char *res;
index 72e77b1138999e42f6b8e4ae645b45b507cad7ed..1b6d114a24c2e730927d95e7e131c30e81894900 100644 (file)
@@ -27,6 +27,7 @@
 #include "defs.h"
 #include "csv_util.h"
 
+#if CSVFMTS_ENABLED
 #define MYNAME "XCSV"
 #define ISSTOKEN(a,b) (strncmp(a,b, strlen(b)) == 0)
 
@@ -592,3 +593,7 @@ ff_vecs_t xcsv_vecs = {
     xcsv_args,
     CET_CHARSET_ASCII, 0       /* CET-REVIEW */
 };
+#else
+void xcsv_read_internal_style(const char *style_buf) {}
+void xcsv_setup_internal_style(const char *style_buf) {}
+#endif //CSVFMTS_ENABLED
index e12b088fc06fea2b41a46c2aa4dd1976d5ca81db..235524291a17ceb155d7b28918474b5e7c1020d6 100644 (file)
@@ -219,7 +219,7 @@ static void
 xml_cdata(void *dta, const XML_Char *xml_s, int len)
 {
        char *estr;
-       const char *s = xml_convert_to_char_string(xml_s);
+       const char *s = xml_convert_to_char_string_n(xml_s, &len);
 
        vmem_realloc(&cdatastr,  1 + len + strlen(cdatastr.mem));
        estr = (char *) cdatastr.mem + strlen(cdatastr.mem);